import request from './request'
export const getDetails = (url, page) => {
  // 关闭eslint
  // eslint-disable-next-line no-unused-vars
  let api = ''
  const pageSize = 20
  const start = (page - 1) * pageSize
  const id = url.slice(url.indexOf('=') + 1)
  if (url.startsWith('youxuan://column')) {
    api = `/api/column/${id}/items?start=${start}`
  } else {
    api = `/api/category/${id}/items?start=${start}`
  }

  return request({
    url: api,
    method: 'get'
  }).then(res => {
    if (res.items) {
      return res.items.list
    }
    return res.list
  })
}
